package pack3;

import java.time.LocalDate;
import java.time.temporal.ChronoUnit;

class MyTime {
    private LocalDate date;

    // 构造函数
    public MyTime(String dateStr) {
        this.date = LocalDate.parse(dateStr);
    }

    // 判断是否为闰年
    public boolean isLeapYear() {
        return date.getYear() % 4 == 0 && (date.getYear() % 100 != 0 || date.getYear() % 400 == 0);
    }

    // 计算numDate天后的时间
    public MyTime addDate(int numDate) {
        LocalDate newDate = date.plusDays(numDate);
        return new MyTime(newDate.toString());
    }

    // 计算两个日期相差的天数
    public int subDate(MyTime other) {
        return (int) ChronoUnit.DAYS.between(date, other.date);
    }

    @Override
    public String toString() {
        return date.toString();
    }
}

public class test8 {
    public static void main(String[] args) {
        MyTime start = new MyTime("2014-11-09");
        MyTime end = start.addDate(1000);
        System.out.println("贝塔炸弹爆炸的准确时间: " + end);
    }
}